<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateItemOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('item_orders', function (Blueprint $table) {
            $table->increments('id');
            $table->char('trade_no', 20)->default('')->comment('交易编号')->unique();
            $table->integer('user_id')->default(0)->comment('用户uid');
            $table->integer('item_id')->default(0)->comment('购买信息的id');
            $table->integer('publisher_uid')->default(0)->comment('信息发布者');
            $table->tinyInteger('status')->default(0)->comment('订单状态: 1待支付,2支付成功,3支付失败');
            $table->decimal('money')->default(0)->comment('金额');
            $table->string('pay_trade_no', 100)->default('')->comment('支付平台的交易编号');
            $table->timestamp('pay_end_time')->nullable()->comment('支付平台的交易结束时间');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('item_orders');
    }
}
